package com.offcn.sellergood;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.offcn.utils.TokenDecode;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;

/**
 * @Author: zola
 * @Date: 2021/9/7 - 09 - 07 - 19:51
 * @Description: com.offcn.sellergood
 * @Version: 1.0
 */
@SpringBootApplication
@EnableDiscoveryClient  // 开启SpringCloud所有的客户端
@MapperScan(basePackages = "com.offcn.sellergood.dao") // 全局配置: 获取持久层代理对象
public class SellergoodServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(SellergoodServiceApplication.class,args);
    }

    //分页拦截器
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }

    @Bean
    public TokenDecode tokenDecode(){
        return new TokenDecode();
    }
}

